<?php
//phpinfo();
require_once 'browser.php';
$browser = new Browser();

$url = 'http://digg.com/';
$result = $browser->get( $url );

$matches = array();
preg_match("!.\"digg_security_token\"\:\"([a-z_0-9]+)\"!i", $result, $matches);
$token = $matches[1];

$url = 'http://digg.com/ajax/auth/verify/loginForm?redirect=http://digg.com/&token=' . $token;
$result = $browser->get( $url );

$form_json = json_decode($result);
$form_json = (array)$form_json;
$form = (array)$form_json['data'];
$form = $form['html'];

$url = 'http://digg.com/ajax/auth/verify/digg';

$post = array(
    'sn' => '',
    'sn_info_key' => '',
    'reg-token' => '',
    'digg-validation' => '[{"key":"id","val":"ident","validators":{"NotBlank":{"errorMessage":"Please enter your email address or username"}}},{"key":"id","val":"password","validators":{"NotBlank":{"errorMessage":"Please enter your password"}}}]',
    'ident' => 'mebatua@gmail.com',
    'password' => '6993479',
    'remember-me' => 'on',
    'submit' => 'Login',
    'token' => $token//'1303929707_991bec568e63c4e8afd5623633aeb56ddb82fd8585c30874d2691f5670d7bc57'
);

$result = $browser->get( $url, $post );

$url = 'http://digg.com';
$result = $browser->get( $url );

print_r( $result );